package com.authine.cloudpivot.web.api.controller;

import com.authine.cloudpivot.web.api.controller.base.BaseController;

import com.authine.cloudpivot.web.api.service.TimingTaskService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


@Api(description = "定时任务", tags = "发起代办流程定时器")
@RestController
@RequestMapping("/api/timingTask")
@Slf4j
@Validated
@Component
public class TimingTaskController extends BaseController {

    @Autowired
    public TimingTaskService timingTaskService;

    /**
     * @Description : 生成任务提交数据
     * @param ：
     * @author : Liun
     * @date : 2020/4/5
     */
    @Scheduled(cron = "0 30 8 ? * *")
    public void createTimingTask(){
        timingTaskService.createTimingTask();
    }

    /**
     * @Description : 自动更新项目执行经理区域省份表
     * @param ：
     * @author : Liun
     * @date : 2020/4/23
     */
    @Scheduled(cron = "0 */3 * * * ?")
    public void updateProjectDetailAuto(){

        timingTaskService.updateProjectDetailAuto();
    }

    /**
     * @Description : 一次性任务提交提示
     * @param ：
     * @author : Liun
     * @date : 2020/4/24
     */
    @Scheduled(cron = "0 30 8 ? * *")
    public void remindTaskOnce(){
        timingTaskService.remindTaskOnce();
    }

}
